<?php
/**
 * Created by PhpStorm.
 * User: cby
 * Date: 2017/7/21
 * Time: 13:46
 */
namespace app\demo\validate;
use think\Validate;
class User extends Validate
{
    protected $rule = [
        'name'  => 'require|max:3',
        'pwd'   => 'require|max:6',
        'remark'   => 'require|email',
    ];

    protected $message = [
        'name.require' => '名称必须',
        'name.max'     => '名称最多不能超过3个字符',
        'pwd.require'   => '密码不为空',
        'remark'        => '邮箱格式错误',
    ];

    protected $scene = [
        'add'   =>  ['name','pwd','remark'],
        'edit'  =>  ['name','pwd'=>'require|number|max:3'],
    ];
}